import { getFn } from '../../store_actions_axiosFn'
import { productListModuleType, GlobalDataProps } from '../../storeType'
import productRedactModule from './product-redact-module/product-redact-module'
import { Module } from 'vuex'
const productListModule: Module<productListModuleType, GlobalDataProps> = {
  namespaced: true,
  state: () => ({
    productData: { pagenum: 1, total: 0 },// 商品列表分页数据
  }),
  mutations: {
    getProductList(state, data: any) {
      if (data.status === 200) {
        state.productData = data.data.data
      }
    }
  },
  actions: {
    getProductList(context, parmas: any) {
      return getFn('/goods', 'getProductList', context.commit, parmas)
    }
  },
  modules: {
    redactModule: productRedactModule
  }
}

export default productListModule